package org.ee.system.service.bo;

import org.ee.core.security.UserPrincipal;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * userDetail扩展
 * @Author jokr
 * @Date 2025/8/22 下午4:12
 */
public class UserDetailBo implements UserDetails, UserPrincipal {

    private Long userId;
    private String username;
    private String password;


    public UserDetailBo(long userId, String username,String password) {
        this.userId = userId;
        this.username = username;
        this.password = password;
    }

    public Long getUserId() {
        return userId;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return UserDetails.super.isAccountNonExpired();
    }

    @Override
    public boolean isAccountNonLocked() {
        return UserDetails.super.isAccountNonLocked();
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return UserDetails.super.isCredentialsNonExpired();
    }

    @Override
    public boolean isEnabled() {
        return UserDetails.super.isEnabled();
    }

    @Override
    public Long getCurrentUserId() {
        return userId;
    }

    @Override
    public String getCurrentUsername() {
        return username;
    }
}
